import { Controller } from "../../mvc/core/Controller";
import { IView } from "../../mvc/interfaces/IView";
import { ArenaCrossModule } from "../../../modules/ArenaCrossModule";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { ServerCommand } from "../mvc/ServerCommand";
import { EPublicCommand } from "../../../Message/Command/EPublicCommand";
import { ArenaCrossAdIconView } from "../view/arenaCross/ArenaCrossAdIconView";
import { SArenaCrossInfo } from "../../../Message/Public/SArenaCrossInfo";
import { ParamsConst } from "../../common/global/ParamsConst";
import { EArenaProcess } from "../../../Message/Public/EArenaProcess";
import { DateUtil } from "../../common/tools/DateUtil";
import { ClockManager } from "../manager/ClockManager";
import { LevelLimitDefin } from "../../common/defin/LevelLimitDefin";
import { EArenaChooseGroupState } from "../../../Message/Public/EArenaChooseGroupState";
import { IArenaCrossModule } from "../../../modules/interfaces/IArenaCrossModule";
import { EArenaChooseFinalPos } from "../../../Message/Public/EArenaChooseFinalPos";
import { DataEvent } from "../events/DataEvent";
import { GameProxy } from "../mvc/GameProxy";
import { ArenaCrossJoinData } from "../view/arenaCross/arenaCrossData/ArenaCrossJoinData";
import { MsgManager } from "../manager/MsgManager";
import { Language } from "../../../extend/language/Language";
import { Alert } from "../../../com/mui/controls/Alert";
import { ENpcEffect } from "../../../Message/Public/ENpcEffect";
import { Game } from "../Game";
import { MapFileUtil } from "../scene/map/MapFileUtil";
import { GameMapUtil } from "../scene/map/GameMapUtil";
import { ArenaCrossGetListData } from "../view/arenaCross/arenaCrossData/ArenaCrossGetListData";
import { SArenaCrossOpen } from "../../../Message/Public/SArenaCrossOpen";
import { SArenaCrossMatch } from "../../../Message/Public/SArenaCrossMatch";
import { SArenaCrossStart } from "../../../Message/Public/SArenaCrossStart";
import { SArenaCrossToplists } from "../../../Message/Public/SArenaCrossToplists";
import { SArenaCrossBattles } from "../../../Message/Public/SArenaCrossBattles";
import { SArenaCrossWaitingNum } from "../../../Message/Public/SArenaCrossWaitingNum";
import { SArenaCrossSignUpState } from "../../../Message/Public/SArenaCrossSignUpState";
import { SArenaCrossBattleRecords } from "../../../Message/Public/SArenaCrossBattleRecords";
import { SArenaCrossResult } from "../../../Message/Public/SArenaCrossResult";
import { SEntityId } from "../../../Message/Public/SEntityId";
import { SArenaCrossChooseGroup } from "../../../Message/Public/SArenaCrossChooseGroup";
import { ArenaCrossGroupNumData } from "../view/arenaCross/arenaCrossData/ArenaCrossGroupNumData";
import { SArenaCrossGroupMembers } from "../../../Message/Public/SArenaCrossGroupMembers";
import { SArenaCrossGroupBattles } from "../../../Message/Public/SArenaCrossGroupBattles";
import { SArenaCrossGroupRingTime } from "../../../Message/Public/SArenaCrossGroupRingTime";
import { SArenaCrossGroupBattleEnd } from "../../../Message/Public/SArenaCrossGroupBattleEnd";
import { SArenaCrossBattleInfo } from "../../../Message/Public/SArenaCrossBattleInfo";
import { BigSendFlower } from "../view/arenaCross/groupMatch/sendFlower/BigSendFlower";
import { EntityUtil } from "../scene/layer/utils/EntityUtil";
import { SArenaCrossFlowerNum } from "../../../Message/Public/SArenaCrossFlowerNum";
import { GetVideoData } from "../view/arenaCross/arenaCrossFinal/data/GetVideoData";
import { ECopyType } from "../../../Message/Public/ECopyType";
import { SArenaCrossChooseFinalPos } from "../../../Message/Public/SArenaCrossChooseFinalPos";
import { SArenaCrossBetPlayerInfos } from "../../../Message/Public/SArenaCrossBetPlayerInfos";
import { ArenaCrossBetWindow } from "../view/arenaCross/arenaCrossFinal/ArenaCrossBetWindow";
import { SArenaCrossBetToplists } from "../../../Message/Public/SArenaCrossBetToplists";
import { ArenaCrossFinalStatusRankWindow } from "../view/arenaCross/arenaCrossFinal/ArenaCrossFinalStatusRankWindow";
import { SArenaCrossMyBetInfos } from "../../../Message/Public/SArenaCrossMyBetInfos";
import { ArenaCrossFinalMyBetRankWindow } from "../view/arenaCross/arenaCrossFinal/ArenaCrossFinalMyBetRankWindow";
import { SArenaCrossFinalBattles } from "../../../Message/Public/SArenaCrossFinalBattles";
import { SArenaCrossFightRecords } from "../../../Message/Public/SArenaCrossFightRecords";
import { ArenaCrossSelectVideoWindow } from "../view/arenaCross/arenaCrossFinal/ArenaCrossSelectVideoWindow";
import { TaskTargetInfo } from "../model/TaskTargetInfo";
type int = number;
//class ArenaCrossController
    
    export  class ArenaCrossController extends Controller
    {
       

        /* internal  */onArenaCrossOpenShopHandler(arg1: Object=null): void
        {
            this.showArenaCrossShopNpc(true);
            return;
        }

        protected /* override */ initView(): IView
        {
            if (!this._arenaCrossModule) 
            {
                this._arenaCrossModule = new ArenaCrossModule();
            }
            return this._arenaCrossModule;
        }

        protected /* override */ initServer(): void
        {
            Dispatcher.addEventListener(EventName.ArenaCrossShowMainWindow, this.onArenaCrossShowMainWindow);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossInfoCommand, this.onArenaCrossInfoHandler);
            Dispatcher.addEventListener(EventName.ArenaCrossEnterWaitRoom, this.onEnterWaitRoom);
            Dispatcher.addEventListener(EventName.ArenaCrossJoin, this.onArenaCrossJoin);
            Dispatcher.addEventListener(EventName.ArenaCrossGetMyArenaInfo, this.onGetMyArenaCrossInfo);
            Dispatcher.addEventListener(EventName.ArenaCrossShowArenaWindow, this.onShowArenaCrossWindow);
            Dispatcher.addEventListener(EventName.ArenaCrossExit, this.onArenaCrossExit);
            Dispatcher.addEventListener(EventName.ArenaCrossExitNow, this.onArenaCrossExitNow);
            Dispatcher.addEventListener(EventName.Scene_Update, this.onSceneUpdate);
            Dispatcher.addEventListener(EventName.ArenaCrossGetArenaLists, this.onRefreshTopList);
            Dispatcher.addEventListener(EventName.ArenaCrossGetArenaBattles, this.onGetArenaCrossBattles);
            Dispatcher.addEventListener(EventName.ArenaCrossLookBattle, this.onLookBattle);
            Dispatcher.addEventListener(EventName.ArenaCrossGetMyBattleRecords, this.onArenaCrossGetMyBattleRecords);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossWillOpenCommand, this.onArenaCrossWillOpenHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossOpenCommand, this.onArenaCrossOpenHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossCloseCommand, this.onArenaCrossCloseHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossMyArenaInfoUpdate, this.onArenaCrossMyArenaCrossInfoUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossMatchCommand, this.onArenaCrossMatchHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossResultCommand, this.onArenaCrossResultHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossStartCommand, this.onArenaCrossStartHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossTopListUpdate, this.onTopListUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossBattlesCommand, this.onArenaCrossBattlesHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossWaitingNumCommand, this.onArenaCrossWaitingNumHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossSignUpStateCommand, this.onArenaCrossSignUpStateHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossBattleRecordsCommand, this.onArenaCrossBattleRecordsHandler);
            Dispatcher.addEventListener(EventName.ArenaCrossGetGroupNumData, this.onArenaCrossGetGroupNumData);
            Dispatcher.addEventListener(EventName.ArenaCrossGroupGetGroupPlayers, this.onArenaCrossGroupGetGroupPlayers);
            Dispatcher.addEventListener(EventName.ArenaCrossGroupSelectGroup, this.onArenaCrossGroupSelectGroup);
            Dispatcher.addEventListener(EventName.ArenaCrossGetGroupBattles, this.onArenaCrossGetGroupBattles);
            Dispatcher.addEventListener(EventName.ArenaCrossFocusArenaCrossPlayer, this.onFocusArenaCrossPlayer);
            Dispatcher.addEventListener(EventName.ArenaCrossGetArenaCrossPlayerInfo, this.onArenaCrossGetArenaCrossPlayerInfo);
            Dispatcher.addEventListener(EventName.ArenaCrossGroupSendFlower, this.onArenaCrossGroupSendFlower);
            Dispatcher.addEventListener(EventName.ArenaCrossGroupShowBigSendFlower, this.onShowBigSendFlower);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossChooseGroupCommand, this.onArenaCrossChooseGroupHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossGroupMembers, this.onArenaCrossGroupMembersHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossGroupBattlesCommand, this.onArenaCrossGroupBattlesHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossGroupRingTimeCommand, this.onArenaCrossGroupRingTimeHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossGroupBattleEndCommand, this.onArenaCrossGroupBattleEndHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossSendFlowerInfo, this.onArenaCrossSendFlowerInfoHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossSendFlowerNum, this.onArenaCrossSendFlowerNumHandler);
            NetDispatcher.addCmdListener(ServerCommand.AreanCrossGroupSendFlowerSuccess, this.onArenaCrossSendFlowerSuccess);
            Dispatcher.addEventListener(EventName.ArenaCrossGetFinalPos, this.onGetFinalPos);
            Dispatcher.addEventListener(EventName.ArenaCrossGetTwoPlayerBetInfo, this.onGetTwoPlayerBetInfo);
            Dispatcher.addEventListener(EventName.ArenaCrossGoToBetSomeOne, this.onArenaCrossGoToBetSomeOne);
            Dispatcher.addEventListener(EventName.ArenaCrossGetStatusInfos, this.onArenaCrossGetStatusInfos);
            Dispatcher.addEventListener(EventName.ArenaCrossFinalGetMyBetInfos, this.onArenaCrossFinalGetMyBetInfos);
            Dispatcher.addEventListener(EventName.ArenaCrossFinalGetMyRewards, this.onArenaCrossFinalGetMyRewards);
            Dispatcher.addEventListener(EventName.ArenaCrossGetFinalMatchData, this.onGetFinalMatchData);
            Dispatcher.addEventListener(EventName.ArenaCrossShowFinalSelectWindow, this.onShowFinalSelectWindow);
            Dispatcher.addEventListener(EventName.ArenaCrossFinalSelectPos, this.onFinalSelectPos);
            Dispatcher.addEventListener(EventName.ArenaCrossShowSteleWindow, this.onArenaCrossShowSteleWindow);
            Dispatcher.addEventListener(EventName.ArenaCrossGetTablet, this.onArenaCrossGetTablet);
            Dispatcher.addEventListener(EventName.ArenaCrossGetVideo, this.onArenaCrossGetVideo);
            Dispatcher.addEventListener(EventName.ArenaCrossLookVideo, this.onArenaCrossLookViedo);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossChooseFinalPosCommand, this.onArenaCrossChooseFinalPosHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossFinalBattlesCommand, this.onArenaCrossFinalBattlesHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossBetPlayerInfosCommand, this.onArenaCrossBetPlayerInfosHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossBetToplistsCommand, this.onArenaCrossBetToplistsHandler);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossMyBetInfosCommand, this.onArenaCrossMyBetInfosHandler);
            NetDispatcher.addCmdListener(ServerCommand.MoneyUpdate, this.onMoneyUpdate);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossGetMyBetRewardSuccessCommand, this.onArenaCrossGetMyBetRewardSuccess);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossTabletCommand, this.onArenaCrossTablet);
            NetDispatcher.addCmdListener(ServerCommand.ArenaCrossFightRecords, this.onArenaCrossFightRecords);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicArenaCrossOpenShop, this.onArenaCrossOpenShopHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicArenaCrossCloseShop, this.onArenaCrossCloseShopHandler);
            return;
        }

        /* internal  */onArenaCrossCloseShopHandler(arg1: Object=null): void
        {
            this.showArenaCrossShopNpc(false);
            return;
        }

        public get arenaCrossAdIconView(): ArenaCrossAdIconView
        {
            if (!this._arenaCrossAdIconView) 
            {
                this._arenaCrossAdIconView = new ArenaCrossAdIconView();
            }
            return this._arenaCrossAdIconView;
        }

        /* internal  */onArenaCrossInfoHandler(arg1: SArenaCrossInfo): void
        {
            var loc1=null;
            var loc2=false;
            if (!ParamsConst.instance.isShowArenaCrossIcon) 
            {
                return;
            }
            if (arg1.processDt && arg1.processDt[EArenaProcess._EArenaElimination1] && arg1.process < EArenaProcess._EArenaFinalMatch2) 
            {
                this.arenaCrossAdIconView.show();
            }
            if (arg1.process == EArenaProcess._EArenaElimination4 && !cache.arenaCross.isOpen && !cache.arenaCross.isWillOpen || arg1.process == EArenaProcess._EArenaGroupMatch1 || arg1.process == EArenaProcess._EArenaGroupMatch2 || arg1.process == EArenaProcess._EArenaFinalMatch1 || arg1.process == EArenaProcess._EArenaFinalMatch2) 
            {
                loc1 = arg1.processDt[EArenaProcess._EArenaFinalMatch2];
                if (!loc1 || DateUtil.getTotalDays(ClockManager.instance.nowDate) - DateUtil.getTotalDays(loc1) < 7) 
                {
                    if (cache.role.entityInfo.level >= LevelLimitDefin.ArenaCrossMinEnterLevel) 
                    {
                        loc2 = false;
                        if (cache.arenaCross.isSelfPromotion() && arg1.chooseGroupState == EArenaChooseGroupState._EArenaChooseGroupStart && arg1.groupId == 0) 
                        {
                            loc2 = true;
                        }
                        (view as IArenaCrossModule).showGroupMatchIcon(true, loc2);
                    }
                }
            }
            else 
            {
                (view as IArenaCrossModule).showGroupMatchIcon(false);
            }
            if (arg1.process == EArenaProcess._EArenaGroupMatch1 && arg1.chooseFinalPosState == EArenaChooseFinalPos._EArenaChooseFinalPosStart && arg1.myProcess > arg1.process) 
            {
                (view as IArenaCrossModule).showFinalMatchIcon();
            }
            else 
            {
                (view as IArenaCrossModule).showFinalMatchIcon(false);
            }
            return;
        }

        /* internal  */onEnterWaitRoom(arg1: DataEvent): void
        {
            GameProxy.arena.enterArenaCross(true, 0);
            return;
        }

        /* internal  */onArenaCrossJoin(arg1: DataEvent): void
        {
            var loc1=arg1.data as ArenaCrossJoinData;
            if (!cache.arenaCross.isOpen) 
            {
                MsgManager.showRollTipsMsg(Language.getString(44200));
                return;
            }
            GameProxy.arena.signUpArenaCross(loc1.isCancelJoin, loc1.arenaMode);
            return;
        }

        /* internal  */onGetMyArenaCrossInfo(arg1: DataEvent): void
        {
            GameProxy.arena.getMyArenaCrossInfo();
            return;
        }

        /* internal  */onShowArenaCrossWindow(arg1: DataEvent=null): void
        {
            (view as IArenaCrossModule).showArenaCrossWindow();
            return;
        }

        /* internal  */onArenaCrossExit(arg1: DataEvent): void
        {
            Alert.show(Language.getString(42201), null, Alert.OK | Alert.CANCEL, null, this.onExitArenaCross);
            return;
        }

        /* internal  */onArenaCrossExitNow(arg1: DataEvent): void
        {
            this.exitArenaCross();
            return;
        }

        /* internal  */onExitArenaCross(arg1: int): void
        {
            if (arg1 == Alert.OK) 
            {
                this.exitArenaCross();
            }
            return;
        }

        /* internal  */exitArenaCross(): void
        {
            GameProxy.arena.enterArenaCross(true, 0);
            return;
        }

        /* internal  */showArenaCrossShopNpc(arg1: Boolean): void
        {
            if (this._npcTargetInfo == null) 
            {
                this._npcTargetInfo = cache.scene.getNpcByEffect(ENpcEffect._ENpcEffectArenaCrossShop);
            }
            if (this._npcTargetInfo) 
            {
                Game.scene.updateNpcIsAddToStage(this._npcTargetInfo.id, arg1, this._npcTargetInfo.mapId);
                if (this._npcTargetInfo.mapId == MapFileUtil.mapID) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.MapUINPCShowOrHide, {"npcId": this._npcTargetInfo.id, "show": arg1}));
                }
            }
            return;
        }

        /* internal  */onSceneUpdate(arg1: DataEvent): void
        {
            if (GameMapUtil.isArenaCross()) 
            {
                this._isInAreaCrossMap = true;
                (view as IArenaCrossModule).enterArenaCross();
                Dispatcher.dispatchEvent(new DataEvent(EventName.TaskTrackShowOrHide, false));
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowGameMainUI, false));
                Dispatcher.dispatchEvent(new DataEvent(EventName.CopyEnterCopyMap));
                Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaClearCd));
            }
            else if (this._isInAreaCrossMap) 
            {
                if (this._bigSendFlower) 
                {
                    this._bigSendFlower.hideAll();
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.CopyLeaveCopyMap));
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowGameMainUI, true));
                (view as IArenaCrossModule).leaveArenaCross();
                Dispatcher.dispatchEvent(new DataEvent(EventName.Role_Relive_City));
                this._isInAreaCrossMap = false;
                Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaCrossExitMap));
            }
            (view as IArenaCrossModule).checkInWaitingRoom();
            return;
        }

        /* internal  */onRefreshTopList(arg1: DataEvent): void
        {
            var loc1=arg1.data as ArenaCrossGetListData;
            GameProxy.arena.getArenaCrossTopList(loc1.process, loc1.isOnlySelfServer, loc1.isOnlyOutLine, loc1.page, loc1.pageSize, loc1.groupId);
            return;
        }

        /* internal  */onGetArenaCrossBattles(arg1: DataEvent): void
        {
            GameProxy.arena.getArenaCrossBattles();
            return;
        }

        /* internal  */onLookBattle(arg1: DataEvent): void
        {
            if (cache.arenaCross.arenaCrossSignUpState && !cache.arenaCross.arenaCrossSignUpState.isCancel) 
            {
                MsgManager.showRollTipsMsg(Language.getString(44256));
                return;
            }
            var loc1=int(arg1.data);
            GameProxy.arena.enterArenaCross(false, loc1);
            return;
        }

        /* internal  */onArenaCrossGetMyBattleRecords(arg1: DataEvent): void
        {
            GameProxy.arena.getMyBattles();
            return;
        }

        /* internal  */onArenaCrossGroupSendFlower(arg1: DataEvent): void
        {
            var loc1=arg1.data.entityId;
            var loc2=arg1.data.bool;
            GameProxy.arena.arenaCrossSendFlower(loc1, loc2);
            return;
        }

        /* internal  */onShowBigSendFlower(arg1: DataEvent): void
        {
            if (this._bigSendFlower) 
            {
                this._bigSendFlower.show();
            }
            return;
        }

        /* internal  */onArenaCrossWillOpenHandler(arg1: Object): void
        {
            if (cache.role.entityInfo.level >= LevelLimitDefin.ArenaCrossMinEnterLevel) 
            {
                (view as IArenaCrossModule).showAreaCrossTipsIcon();
            }
            (view as IArenaCrossModule).winOpen();
            return;
        }

        /* internal  */onArenaCrossOpenHandler(arg1: SArenaCrossOpen): void
        {
            (view as IArenaCrossModule).open(arg1);
            return;
        }

        /* internal  */onArenaCrossCloseHandler(arg1: Object): void
        {
            (view as IArenaCrossModule).close();
            if (cache.arenaCross.arenaCrossInfo) 
            {
                this.onArenaCrossInfoHandler(cache.arenaCross.arenaCrossInfo);
            }
            return;
        }

        /* internal  */onArenaCrossMyArenaCrossInfoUpdateHandler(arg1: Object): void
        {
            (view as IArenaCrossModule).updateMyArenaCrossInfo(cache.arenaCross.myArenaCrossInfo);
            return;
        }

        /* internal  */onArenaCrossMatchHandler(arg1: SArenaCrossMatch): void
        {
            (view as IArenaCrossModule).arenaCrossMatch(arg1);
            return;
        }

        /* internal  */onArenaCrossStartHandler(arg1: SArenaCrossStart): void
        {
            (view as IArenaCrossModule).arenaCrossStart(arg1);
            MsgManager.showTaskTarget(Language.getString(42202));
            return;
        }

        /* internal  */onTopListUpdateHandler(arg1: SArenaCrossToplists): void
        {
            (view as IArenaCrossModule).arenaCrossUpdateTopList(arg1);
            return;
        }

        /* internal  */onArenaCrossBattlesHandler(arg1: SArenaCrossBattles): void
        {
            (view as IArenaCrossModule).arenaCrossUpdateBattles(arg1.battles);
            return;
        }

        /* internal  */onArenaCrossWaitingNumHandler(arg1: SArenaCrossWaitingNum): void
        {
            (view as IArenaCrossModule).arenaCrossUpdateWaitingNum(arg1);
            return;
        }

        /* internal  */onArenaCrossSignUpStateHandler(arg1: SArenaCrossSignUpState): void
        {
            (view as IArenaCrossModule).updateSignUpState(arg1);
            return;
        }

        /* internal  */onArenaCrossBattleRecordsHandler(arg1: SArenaCrossBattleRecords): void
        {
            (view as IArenaCrossModule).updateArenaCrossBattleRecords(arg1);
            return;
        }

        /* internal  */onArenaCrossResultHandler(arg1: SArenaCrossResult): void
        {
            if (arg1.isBattler) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaClearCd));
            }
            (view as IArenaCrossModule).arenaCrossResult(arg1);
            return;
        }

        /* internal  */onArenaCrossShowMainWindow(arg1: DataEvent): void
        {
            (view as IArenaCrossModule).showMatchWindow();
            return;
        }

        /* internal  */onArenaCrossGetGroupNumData(arg1: DataEvent): void
        {
            GameProxy.arena.chooseArenaCrossGroup(0);
            return;
        }

        /* internal  */onArenaCrossGroupGetGroupPlayers(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            GameProxy.arena.getArenaCrossGroupMembers(loc1);
            return;
        }

        /* internal  */onArenaCrossGroupSelectGroup(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            if (cache.arenaCross.arenaCrossInfo.chooseGroupState != EArenaChooseGroupState._EArenaChooseGroupStart) 
            {
                MsgManager.showRollTipsMsg(Language.getString(44270));
            }
            else 
            {
                GameProxy.arena.chooseArenaCrossGroup(loc1);
            }
            return;
        }

        /* internal  */onArenaCrossGetGroupBattles(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            GameProxy.arena.getArenaCrossGroupBattles(loc1);
            return;
        }

        /* internal  */onFocusArenaCrossPlayer(arg1: DataEvent): void
        {
            var loc1=arg1.data as SEntityId;
            GameProxy.arena.focusArenaCrossPlayer(loc1);
            return;
        }

        /* internal  */onArenaCrossGetArenaCrossPlayerInfo(arg1: DataEvent): void
        {
            var loc1=arg1.data as SEntityId;
            GameProxy.arena.getArenaCrossPlayerInfo(loc1);
            return;
        }

        /* internal  */onArenaCrossChooseGroupHandler(arg1: SArenaCrossChooseGroup): void
        {
            var loc3=null;
            var loc1=new Array<any>();
            var loc2=1;
            while (loc2 <= 16) 
            {
                (loc3 = new ArenaCrossGroupNumData()).groupId = int(loc2);
                loc3.maxNum = arg1.maxPlayerNum;
                loc3.currentNum = arg1.groupPlayerNum.hasOwnProperty(loc2) ? arg1.groupPlayerNum[loc2] : 0;
                loc3.isHaveSignUp = arg1.myGroupId > 0;
                loc3.isSignUpThis = arg1.myGroupId == loc3.groupId;
                loc1.push(loc3);
                ++loc2;
            }
            (view as IArenaCrossModule).updateGroupNumData(loc1);
            return;
        }

        /* internal  */onArenaCrossGroupMembersHandler(arg1: SArenaCrossGroupMembers): void
        {
            (view as IArenaCrossModule).updateGroupMembers(arg1);
            return;
        }

        /* internal  */onArenaCrossGroupBattlesHandler(arg1: SArenaCrossGroupBattles): void
        {
            (view as IArenaCrossModule).updateGroupBattles(arg1);
            return;
        }

        /* internal  */onArenaCrossGroupRingTimeHandler(arg1: SArenaCrossGroupRingTime): void
        {
            (view as IArenaCrossModule).updateGroupRingTime(arg1);
            return;
        }

        /* internal  */onArenaCrossGroupBattleEndHandler(arg1: SArenaCrossGroupBattleEnd): void
        {
            (view as IArenaCrossModule).updateGroupBattleEnd(arg1);
            return;
        }

        public isInitView(): Boolean
        {
            return !(this._arenaCrossModule == null);
        }

        /* internal  */onArenaCrossSendFlowerInfoHandler(arg1: SArenaCrossBattleInfo): void
        {
            if (!this._bigSendFlower) 
            {
                this._bigSendFlower = new BigSendFlower();
            }
            this._bigSendFlower.updateBattleInfo(arg1);
            var loc1=EntityUtil.toString(cache.role.entityInfo.entityId);
            var loc2=EntityUtil.toString(arg1.miniPlayerOne.entityId);
            var loc3=EntityUtil.toString(arg1.miniPlayerTwo.entityId);
            if (loc1 == loc2 || loc1 == loc3 || arg1.hadSendFlower) 
            {
                this._bigSendFlower.lockSmall();
            }
            else 
            {
                this._bigSendFlower.show();
            }
            return;
        }

        /* internal  */onArenaCrossSendFlowerNumHandler(arg1: SArenaCrossFlowerNum): void
        {
            if (this._bigSendFlower) 
            {
                this._bigSendFlower.updateInfo(arg1);
            }
            return;
        }

        /* internal  */onArenaCrossSendFlowerSuccess(arg1: Object=null): void
        {
            if (this._bigSendFlower) 
            {
                this._bigSendFlower.updateSendSuccess();
                this._bigSendFlower.miniSize();
            }
            return;
        }

        /* internal  */onGetFinalPos(arg1: DataEvent): void
        {
            GameProxy.arena.chooseArenaCrossFinalPos(0);
            return;
        }

        /* internal  */onGetFinalMatchData(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            GameProxy.arena.getArenaCrossFinalBattles(loc1);
            return;
        }

        /* internal  */onShowFinalSelectWindow(arg1: DataEvent): void
        {
            (view as IArenaCrossModule).showFinalSelectWindow();
            return;
        }

        /* internal  */onFinalSelectPos(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            GameProxy.arena.chooseArenaCrossFinalPos(loc1);
            return;
        }

        /* internal  */onArenaCrossShowSteleWindow(arg1: DataEvent): void
        {
            (view as IArenaCrossModule).showTabletWindow();
            return;
        }

        /* internal  */onArenaCrossGetTablet(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            GameProxy.arena.getArenaCrossTablet(loc1);
            return;
        }

        /* internal  */onArenaCrossGetVideo(arg1: DataEvent): void
        {
            var loc1=arg1.data as GetVideoData;
            GameProxy.arena.getArenaCrossFightRecords(loc1.finalPosType, loc1.finalPos);
            return;
        }

        /* internal  */onArenaCrossLookViedo(arg1: DataEvent): void
        {
            var loc1=arg1.data.toString();
            GameProxy.arena.watchFightRecord(ECopyType._ECopyArenaCross, loc1);
            return;
        }

        /* internal  */onArenaCrossChooseFinalPosHandler(arg1: SArenaCrossChooseFinalPos): void
        {
            (view as IArenaCrossModule).updateFinalPos(arg1);
            return;
        }

        /* internal  */onGetTwoPlayerBetInfo(arg1: DataEvent): void
        {
            var loc1=int(arg1.data.finalPosType);
            var loc2=int(arg1.data.finalPos);
            GameProxy.arena.getArenaCrossBetPlayerInfos(loc1, loc2);
            return;
        }

        /* internal  */onArenaCrossBetPlayerInfosHandler(arg1: SArenaCrossBetPlayerInfos): void
        {
            ArenaCrossBetWindow.instance.updateInfo(arg1);
            return;
        }

        /* internal  */onArenaCrossGoToBetSomeOne(arg1: DataEvent): void
        {
            var loc1=arg1.data.entityId;
            var loc2=arg1.data.num;
            var loc3=arg1.data.unit;
            GameProxy.arena.betArenaCross(loc1, loc2, loc3);
            return;
        }

        /* internal  */onArenaCrossGetStatusInfos(arg1: DataEvent): void
        {
            var loc1=arg1.data.page;
            var loc2=arg1.data.pageSize;
            GameProxy.arena.getArenaCrossBetToplists(loc1, loc2);
            return;
        }

        /* internal  */onArenaCrossBetToplistsHandler(arg1: SArenaCrossBetToplists): void
        {
            ArenaCrossFinalStatusRankWindow.instance.updateInfo(arg1);
            return;
        }

        /* internal  */onArenaCrossFinalGetMyBetInfos(arg1: DataEvent): void
        {
            GameProxy.arena.getArenaCrossMyBetInfos();
            return;
        }

        /* internal  */onArenaCrossMyBetInfosHandler(arg1: SArenaCrossMyBetInfos): void
        {
            ArenaCrossFinalMyBetRankWindow.instance.updateInfo(arg1);
            return;
        }

        /* internal  */onArenaCrossFinalGetMyRewards(arg1: DataEvent): void
        {
            GameProxy.arena.drawArenaCrossBetReward();
            return;
        }

        /* internal  */onMoneyUpdate(arg1: Object): void
        {
            if (ArenaCrossBetWindow.hasInstance()) 
            {
                ArenaCrossBetWindow.instance.updateMoney();
            }
            if (ArenaCrossFinalMyBetRankWindow.hasInstance()) 
            {
                ArenaCrossFinalMyBetRankWindow.instance.updateMoney();
            }
            return;
        }

        /* internal  */onArenaCrossFinalBattlesHandler(arg1: SArenaCrossFinalBattles): void
        {
            (view as IArenaCrossModule).updateFinalBattles(arg1);
            return;
        }

        /* internal  */onArenaCrossTablet(arg1: SArenaCrossFinalBattles): void
        {
            (view as IArenaCrossModule).updateTablet(arg1);
            return;
        }

        /* internal  */onArenaCrossFightRecords(arg1: SArenaCrossFightRecords): void
        {
            if (arg1) 
            {
                ArenaCrossSelectVideoWindow.instance.updateRecords(arg1);
                ArenaCrossSelectVideoWindow.instance.show();
            }
            return;
        }

        /* internal  */onArenaCrossGetMyBetRewardSuccess(arg1: Object=null): void
        {
            ArenaCrossBetWindow.instance.updateMyRewardNum();
            ArenaCrossFinalMyBetRankWindow.instance.updateMyRewardNum();
            return;
        }

        private /* var */_arenaCrossModule: IArenaCrossModule;

        private /* var */_arenaCrossAdIconView: ArenaCrossAdIconView;

        private /* var */_isInAreaCrossMap: Boolean=false;

        private /* var */_npcTargetInfo: TaskTargetInfo;

        private /* var */_bigSendFlower: BigSendFlower;
    }
